﻿using BT_web__nhom06.TienIch;
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace QL_DoanvienNew
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            TienIchWeb.ThoatDangNhap();
        }

        protected void btn_submit_Click(object sender, EventArgs e)
        {
            string username = txt_username.Text;
            string pass = txt_password.Text;

            if (Membership.ValidateUser(username, pass))
            {
                //Username va pass hop le
                lblThongBao.Visible = false;
                bool rememberMe = false;
                TienIchWeb.LuuThongTinDangNhap(username, rememberMe);//TODO: thay bang checkbox nho hay khong
                FormsAuthentication.RedirectFromLoginPage(username, rememberMe);
                // btnLogout.Visible = true;

            }
            else
            { 
                //TODO: Thong bao sai pass
                lblThongBao.Visible = true;

            }
        }

        protected void btnLogout_Click(object sender, EventArgs e)
        {
            TienIchWeb.ThoatDangNhap();
        }


    }
}